﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cody.CsvProcessor;

namespace CsvTester
{
    class Program
    {
        static void Main(string[] args)
        {
            string csvString =
                "ColumnA,ColumnB,ColumnC\r\n" +
                "1,2,3\r\n" +
                "1,\"1,2,3\",3\r\n" +
                "1,\"1,\"\"123\"\",\",3\r";

            using (CsvHelper csvHelper = new CsvHelper(csvString, 3, true))
            {
                int rowCount = 0;
                while (!csvHelper.EndOfFile)
                {
                    var row = csvHelper.ReadRow();
                    if (row == null)
                    {
                        continue;
                    }
                    Console.WriteLine("Line Width: {0}", row.Count);
                    foreach (string s in row)
                    {
                        Console.WriteLine(s);
                    }
                    Console.WriteLine("*****************");
                    rowCount++;
                }
                Console.WriteLine("Row count: {0}", rowCount);
            }
            Console.ReadLine();
        }
    }
}
